﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace MoetutuServer.WebSite.PicServer.TagUpdate
{
    class UpdateforRoma
    {
        public static List<string> InitSearchForOldTag(string TagInfo)
        {
            List<string> TempList = new List<string>();
            //P站-------pixiv
            String[] TagSplit = Regex.Split(TagInfo, "-------");
            string Cntag = "";
            string RomeTag = "";
            if (TagSplit.Count() == 2)
            {

                Cntag = TagSplit[0].Trim();
                RomeTag = TagSplit[1].Trim();
            }

            if (Cntag == "" || RomeTag == "")
                return null;
            TempList = WebSite.PicServer.TagUpdate.TagUpdateHelper.  SearchList(RomeTag);
            StartTagModifyForList(RomeTag, Cntag, TempList);
            return TempList;
        }
        /// <summary>
        /// 启动修改
        /// </summary>
        /// <param name="OrignTag">未汉化</param>
        /// <param name="ChineseTag">已汉化</param>
        /// <param name="tempList">需要修改的文件列表</param>
        public static void StartTagModifyForList(string OrignTag, string ChineseTag, List<string> tempList)
        {
            foreach (string SingleLink in tempList)
            {

                TagUpdateHelper. StartTagModifySingle(OrignTag, ChineseTag, SingleLink);
            }
        }
    }
}
